% FileHandler.m
% 负责文件内容的处理和显示
classdef FileHandler < handle
    properties
        filePath
    end
    
    methods
        function obj = FileHandler(filePath)
            % 构造函数：初始化文件路径
            obj.filePath = filePath;
        end
        
        function content = readFile(obj)
            % 读取文件内容
            fileID = fopen(obj.filePath, 'r');
            if fileID == -1
                content = 'Error: Could not open file.';
            else
                content = fread(fileID, '*char')';
                fclose(fileID);
            end
        end
    end
end
